package com.zzc.keleoj.judge.codesandbox.impl;

import com.zzc.keleoj.judge.codesandbox.CodeSandBox;
import com.zzc.keleoj.judge.codesandbox.model.ExecuteCodeRequest;
import com.zzc.keleoj.judge.codesandbox.model.ExecuteCodeResponse;
import com.zzc.keleoj.model.dto.questionSubmit.JudgeInfo;
import com.zzc.keleoj.model.enums.JudgeInfoMessageEnum;
import com.zzc.keleoj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

public class ThirdPartyCodeSandBox implements CodeSandBox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        // 获取输入用例
        List<String> inputList = executeCodeRequest.getInputList();
        // 执行代码
        ExecuteCodeResponse response = new ExecuteCodeResponse();
        response.setMessage("第三方测试执行成功");
        response.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        response.setJudgeInfo(new JudgeInfo(1000L, 512L, JudgeInfoMessageEnum.ACCEPTED.getText()));
        response.setOutputList(inputList);
        // 返回输出结果
        System.out.println("第三方测试执行成功");
        return response;
    }
}
